package com.zjh.controller;

import com.zjh.dao.sysUserDao;
import com.zjh.feign.FeignUser;
import com.zjh.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api("TestController")
@RequestMapping("/test")
public class TestController {


    @Autowired
    private FeignUser feignUser;

    @GetMapping("hello")
    public String add()
    {
        Response<sysUserDao> user = feignUser.queryUsrByUsrname("lww");
        return user.getObj().getPasswordHash();
    }

    @ApiOperation(value = "添加用户", notes = "添加一个用户,传入用户名和地址")
    @PostMapping("/add")
    public Response insertUsr(@RequestBody sysUserDao usr)
    {
        return feignUser.insertUsr(usr);
    }

    @GetMapping("index")
    public String index()
    {
        return "hello index";
    }
}
